package net.cityside.summer.web.security;

import net.cityside.summer.domain.User;

import org.springframework.security.core.context.SecurityContextHolder;

public class WebSecurityUtil {

	public static User getCurrentUser() {
		Object principal = SecurityContextHolder.getContext()
				.getAuthentication().getPrincipal();
		if (principal instanceof SecuredUser) {
			return ((SecuredUser) principal).getUser();
		} else {
			return null;
		}
	}
}
